-- View: public.vcommov_lbc

-- DROP VIEW public.vcommov_lbc;

CREATE OR REPLACE VIEW public.vcommov_lbc AS 
 SELECT m.idcomm,
    m.id,
    m.tipomov,
    m.signo,
    m.piva,
    m.idctb,
    m.orden,
    m.impo,
    m.fechacomm,
    m.idctbcos1,
    m.idctbcos2,
    m.tipocom,
    m.codambsuc,
    m.codctbsub,
    m.fecharesumen,
    m.alicuota,
    m.presupuesto,
    m.idambdb,
    m.fechainsert,
    m.fechaupdate,
    m.idctbcos3,
    m.idctbcos4,
    comm.idpad,
    comm.idpadfiscal
   FROM commov m
     JOIN comm ON m.idcomm = comm.id
  WHERE NOT (EXISTS ( SELECT comvis.cod,
            comvis.nombre,
            comvis.idambdb,
            comvis.fechainsert,
            comvis.fechaupdate
           FROM comvis
          WHERE comvis.cod::text = '9-LBC'::text)) OR (comm.tipocom::text IN ( SELECT comvisxcom.tipocom
           FROM comvisxcom
          WHERE comvisxcom.codcomvis::text = '9-LBC'::text));

ALTER TABLE public.vcommov_lbc OWNER TO abacouser;


-- =================================
SELECT aaVersion('455.00','454.01');
-- =================================